//app.js
App({
  onLaunch: function () {
    wx.getSetting({
      success: res => {
        // console.log(res)
        if (res.authSetting['scope.userInfo']) {
          this.globalData.isAuthorized =  true
          wx.getUserInfo({
            success: res => {
              // console.log(res)
              this.globalData.userInfo = res.userInfo
              this.globalData.res = res
              // 由于 getUserInfo 是网络请求，可能会在 Page.onLoad 之后才返回
              // 所以此处加入 callback 以防止这种情况
              if (this.userInfoReadyCallback) {
                this.userInfoReadyCallback(res)
              }
            }
          })
        }else{
          this.globalData.isAuthorized =  false
        }
      }
    })
  },

  globalData: {
    userInfo: null,
      userId: '',
      apiUrl:'https://jkfx.tianjinliwu.com.cn',
      openid:'',
      puid: '',
      code : null,
      res: null
  }
})